#include "luaVm.h"

#include <osg/Vec3f>
#include <osg/Vec4f>
#include <luabind/luabind.hpp>

using namespace  Osgis;

LuaVMachine* LuaVMachine::_luaVm = new LuaVMachine();

Osgis::LuaVMachine::LuaVMachine()
{
	_lua = lua_open();
	luaopen_base(_lua);
	registerOsg();
}

Osgis::LuaVMachine::~LuaVMachine()
{
	lua_close(_lua);
}

LuaVMachine* Osgis::LuaVMachine::getInstance()
{
	return _luaVm;
}

lua_State* Osgis::LuaVMachine::getLuaVm()
{
	return _lua;
}

void Osgis::LuaVMachine::registerOsg()
{
	/*
	using namespace luabind;
	module(_lua)
		[
			class_<osg::Vec3f>("Vec3f")
			.def(constructor<>())
			.def(constructor<float, float, float>())
			.def("valid", &osg::Vec3f::valid)
// 			class_<osg::Vec4f>("Vec4f")
// 			.def(constructor<>())
// 			.def(constructor<float, float, float, float>())
		];
		*/
}
